/**
 * 
 */
package com.es.controller;

import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import org.apache.log4j.Logger;

import com.es.model.Lead;
import com.es.util.ProjectConstant;

/**
 * @author Bushra Nazir
 *
 */
public class UtilityController extends BaseController{

	private static final Logger log = Logger.getLogger(UtilityController.class);

	public static  List<SelectItem> getLeadSourceSelectItems(){

		log.info("Generate source selectitems...");

		List<SelectItem> leadSourceSelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < ProjectConstant.LEAD_SOURCE_LIST.length ; i++){
			leadSourceSelectItems.add(new SelectItem( ProjectConstant.LEAD_SOURCE_LIST[i] , ProjectConstant.LEAD_SOURCE_LIST[i]));
		}

		return leadSourceSelectItems;

	}
	
	public static  List<SelectItem> getIndustrySelectItems(){

		log.info("Generate industry selectitems...");

		List<SelectItem> industrySelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < ProjectConstant.INDUSTRY_LIST.length ; i++){
			industrySelectItems.add(new SelectItem( ProjectConstant.INDUSTRY_LIST[i] , ProjectConstant.INDUSTRY_LIST[i]));
		}

		return industrySelectItems;

	}
	
	public static  List<SelectItem> getLeadStatusSelectItems(){

		log.info("Generate lead status selectitems...");

		List<SelectItem> leadStatusSelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < ProjectConstant.LEAD_STATUS_LIST.length ; i++){
			leadStatusSelectItems.add(new SelectItem( ProjectConstant.LEAD_STATUS_LIST[i] , ProjectConstant.LEAD_STATUS_LIST[i]));
		}

		return leadStatusSelectItems;

	}
	
	public static  List<SelectItem> getLeadRatingSelectItems(){

		log.info("Generate lead rating selectitems...");

		List<SelectItem> leadRatingSelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < ProjectConstant.LEAD_RATING_LIST.length ; i++){
			leadRatingSelectItems.add(new SelectItem( ProjectConstant.LEAD_RATING_LIST[i] , ProjectConstant.LEAD_RATING_LIST[i]));
		}

		return leadRatingSelectItems;

	}
	

	public static  List<SelectItem> getDeadLeadSelectItems( List<Lead> deadLeadList){

		log.info("Generate dead lead selectitems...");
		String leadFullName = null;

		List<SelectItem> deadLeadListSelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < deadLeadList.size(); i++){
			leadFullName = deadLeadList.get(i).getFirstname()+ " " + deadLeadList.get(i).getLastname();
			deadLeadListSelectItems.add(new SelectItem(deadLeadList.get(i).getLeadId().toString(), leadFullName ));
		} 

		return deadLeadListSelectItems;

	}
	
	public static  List<SelectItem> getContactTypeSelectItems(){

		log.info("Generate contact type selectitems...");

		List<SelectItem> contactTypeListSelectItems = new ArrayList<SelectItem>();

		for(int i = 0; i < ProjectConstant.CONTACT_TYPE_LIST.length ; i++){
			contactTypeListSelectItems.add(new SelectItem( ProjectConstant.CONTACT_TYPE_CD_LIST[i] , ProjectConstant.CONTACT_TYPE_LIST[i]));
		}

		return contactTypeListSelectItems;

	}
	
	
	
	
}
